import {
  Controller,
  Get,
  Post,
  Body,
  Req,
  SetMetadata,
  UsePipes,
  ValidationPipe,
  Param,
  Query,
} from '@nestjs/common';
import { ApparatusDto } from './apparatus.dto';
import { ApparatusService } from './apparatus.service';
@SetMetadata('isLogger', true)
@Controller()
export class ApparatusController {
  constructor(private readonly apparatusService: ApparatusService) {}

  @Get('/getApparatusList')
  getApparatusList(
    @Query()
    params: {
      pageIndex: number;
      pageSize: number;
      title: string;
      parent_id: string;
    },
  ) {
    return this.apparatusService.getApparatusList(params);
  }

  @Post('/apparatusDelete')
  apparatusDelete(@Body() ids: string[]) {
    console.log('ids', ids);

    return this.apparatusService.apparatusDelete(ids);
  }

  @Post('/apparatusUpdate')
  apparatusUpdate(@Body() apparatusDto: ApparatusDto) {
    return this.apparatusService.apparatusUpdate(apparatusDto);
  }

  @Post('/apparatusAdd')
  apparatusAdd(@Body() apparatusDto: ApparatusDto) {
    return this.apparatusService.apparatusAdd(apparatusDto);
  }
}
